package com.wish.g04.financial.controller;

import com.wish.g04.base.entity.SfContract;
import com.wish.g04.common.core.web.controller.BaseController;
import com.wish.g04.common.core.web.domain.AjaxResult;
import com.wish.g04.common.core.web.page.TableDataInfo;
import com.wish.g04.financial.dto.JrRentInstallmentDTO;
import com.wish.g04.financial.service.TbJrRenInstallmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 申请租房贷
 */
@RestController
@RequestMapping("/settlementHouse")
public class SettlementHouseController extends BaseController {

    @Autowired
    TbJrRenInstallmentService tbJrRenInstallmentService;

    /**
     *  收房列表
     */
    @GetMapping("getSFContractList")
    public TableDataInfo getSFContractList(SfContract sfContract){
        startPage();
        return tbJrRenInstallmentService.getSFContractList(sfContract);
    }

    /**
     *  根据租房合同id查询
     */
    @GetMapping("getSFContractById/{id}")
    public AjaxResult getSFContractById(@PathVariable Integer id){
        return tbJrRenInstallmentService.getSFContractById(id);
    }

    /**
     *  金融计算器
     */
    @PostMapping("counter")
    public AjaxResult counter(JrRentInstallmentDTO jrRentInstallmentDto){
        return tbJrRenInstallmentService.SFcounter(jrRentInstallmentDto);
    }

    /**
     *  添加申请租房贷
     */
    @PostMapping("saveSfContractStage")
    public AjaxResult saveSfContractStage(JrRentInstallmentDTO jrRentInstallmentDto){
        return tbJrRenInstallmentService.saveSfContractStage(jrRentInstallmentDto);
    }
}
